package com.hhkj.payment.wechat.common.conf;

import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * WechatConf
 *
 * @author HHKJ-SERVER-ZJ
 * @since 2023/11/14 9:03
 */
@Component
@ConfigurationProperties(prefix = "payment.wechat")
public class WechatConf {

    /** APP应用id */
    @Getter
    private static String appId;

    /** 小程序应用id */
    @Getter
    private static String mpAppId = "";

    /** 服务号应用id */
    @Getter
    private static String serviceAppId;

    /** 商户号 */
    @Getter
    private static String mchId = "";


    /** 私钥 */
    @Getter
    private static String privateKey = "";

    /** pem 证书 */
    @Getter
    private static String apiClientCertPemPath;

    /** p12 证书 */
    //  private static static String apiclient_cert_p12;

    /** 商户证书序列号 */
    @Getter
    private static String mchSerialNo = "";

    /** apiv3私钥 */
    @Getter
    private static String apiV3Key = "";

    /** apiv3私钥 */
    @Getter
    private static String apiV2Key = "";

    /** 创建订单回调地址 */
    @Getter
    private static String notifyUrl = "";

    /** 是否是生产环境 */
    @Getter
    private static Boolean isPro = false;

    public void setAppId(String appId) {
        WechatConf.appId = appId;
    }

    public void setMpAppId(String mpAppId) {
        WechatConf.mpAppId = mpAppId;
    }

    public void setServiceAppId(String serviceAppId) {
        WechatConf.serviceAppId = serviceAppId;
    }


    public void setMchId(String mchId) {
        WechatConf.mchId = mchId;
    }

    public void setPrivateKey(String privateKey) {
        WechatConf.privateKey = privateKey;
    }

    public void setApiClientCertPemPath(String apiClientCertPemPath) {
        WechatConf.apiClientCertPemPath = apiClientCertPemPath;
    }

    public void setMchSerialNo(String mchSerialNo) {
        WechatConf.mchSerialNo = mchSerialNo;
    }

    public void setApiV3Key(String apiV3Key) {
        WechatConf.apiV3Key = apiV3Key;
    }

    public void setApiV2Key(String apiV2Key) {
        WechatConf.apiV2Key = apiV2Key;
    }

    public void setNotifyUrl(String createOrderNotifyUrl) {
        WechatConf.notifyUrl = createOrderNotifyUrl;
    }

    public void setIsPro(Boolean isPro) {
        WechatConf.isPro = isPro;
    }
}
